<?php


namespace app\admin\controller\general;


use app\admin\controller\Controller;
use app\admin\model\BaseSetting;
class Storage extends Controller
{

    /**
     * 上传设置
     * @return mixed
     * @throws \think\exception\DbException
     */
    public function index(){
        if (!$this->request->isAjax()) {
            $model = BaseSetting::detail('storage');
            return $this->fetch('index',  compact('model'));
        }
        $model = new BaseSetting;
        if ($model->edit('storage', $this->postData('storage'))) {
            return $this->renderSuccess('操作成功');
        }
        return $this->renderError($model->getError() ?: '操作失败');
    }
}